﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package net.wooga.pets.controllers.contracts {
    import net.wooga.pets.loading.vos.*;
    import net.wooga.pets.events.*;
    import net.wooga.pets.constants.*;
    import org.robotlegs.mvcs.*;
    import net.wooga.pets.models.world.*;

    public class FinalizeContractCommand extends Command {

        public var world:WorldModel;

        override public function execute():void{
            var _local1:String = this.world.getRoomIdsOfType(GameConstants.TYPE_DOCK)[0];
            var _local2:RequestEvent = new RequestEvent(EventConstants.SEND_REQUEST, this.onResult);
            _local2.addRequest("finalize_contract", {id:_local1});
            dispatch(_local2);
        }
        private function onResult(_arg1:ResultVO):void{
            var _local2:Object;
            var _local3:String;
            if (_arg1.success){
                _local2 = _arg1.data.finalize_contract;
                _local3 = this.world.getRoomIdsOfType(GameConstants.TYPE_DOCK)[0];
                dispatch(new InfoEvent(EventConstants.CREATE_REWARD_ICONS, _local3, _local2.items));
            };
        }

    }
}//package net.wooga.pets.controllers.contracts 
